package com.hdu.InheritableThreadLocalDemo;

import java.util.concurrent.TimeUnit;

public class Demo2 {
    public static void main(String[] args) throws InterruptedException {
        ThreadLocal<String> threadLocal = new InheritableThreadLocal<>();
        threadLocal.set("父线程设置的值");
        TimeUnit.MILLISECONDS.sleep(
                500
        );
        new Thread(() -> System.out.println("子线程获取的值：" + threadLocal.get())).start();
    }
}
